﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProgramUpDate
{
    public class Common
    {
        public static void WriterLogs(string Function, string Message)
        {
            try
            {
                string DirectoryDate = DateTime.Now.ToString("yyyyMMdd");
                string sPath = System.Environment.CurrentDirectory + "\\Logs";
                if (Directory.Exists(sPath) == false)
                {
                    Directory.CreateDirectory(sPath);
                }
                StreamWriter swWriter;
                swWriter = File.AppendText(sPath + "/" + DirectoryDate + ".txt");
                swWriter.Write(Function + " ：" + Message);
                swWriter.WriteLine("\r\n【时间         】：" + DateTime.Now.ToString());
                swWriter.WriteLine();
                swWriter.Flush();
                swWriter.Dispose();
            }
            catch (Exception ex)
            {

            }
        }
    }
}
